﻿using OD.ProjectCustomizationTool.Helpers;
using OD.ProjectCustomizationTool.Tools;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OD.ProjectCustomizationTool
{
    /// <summary>
    /// Main entry point that allows to apply projects modifications.
    /// </summary>
    public static class ToolsManager
    {

        /// <summary>
        /// Update the project by applying Object Direct compliances.
        /// </summary>
        /// <param name="project">The project to consider.</param>
        /// <param name="logger">The log mechanism.</param>
        public static void Update(EnvDTE.Project project, ILogger logger)
        {
            if (project == null)
            {   // This code has been generated from the 'argnull' custom snippet.
                throw new ArgumentNullException("project");
            }
            if (logger == null)
            {   // This code has been generated from the 'argnull' custom snippet.
                throw new ArgumentNullException("logger");
            }

            logger.WriteLine("===== Applying compliances to project '" + project.Name + "'");
            using (var monitor = new ProjectMonitor(project, logger))
            {
                monitor.Update<AssemblySigner>();
                monitor.Update<IconSetter>();
                monitor.Update<CodeAnalysisDictionaryCustomizer>();
                monitor.Update<NameSpacer>();
                monitor.Update<CodeAnalysisEnabler>();
                monitor.Update<StyleCopRegister>();
                monitor.Update<StyleCopCustomizer>();
                monitor.Update<CodeAnalysisRuleSetter>();
                monitor.Update<CLSCompliantSetter>();
                monitor.Update<ResourcesLanguageSetter>();
                monitor.Update<CompanySetter>();
                monitor.Update<NoCodeAnalysisConfigurationRegister>();
                monitor.Update<EntLibLogging>();
                monitor.Update<DocumentationFileSetter>();
            }
            logger.WriteLine("===== Compliances applied to project '" + project.Name + "'");
        }
    }
}
